package cn.virens.common.mybatis.datasource.annotations.config;

import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AdviceModeImportSelector;
import org.springframework.context.annotation.AutoProxyRegistrar;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class DynamicDataSourceConfigurationSelector extends AdviceModeImportSelector<EnableDynamicDataSource> {

    @Override
    protected String[] selectImports(AdviceMode adviceMode) {
        List<String> result = new ArrayList<>(2);
        result.add(AutoProxyRegistrar.class.getName());
        result.add(DynamicDataSourceConfiguration.class.getName());

        return StringUtils.toStringArray(result);
    }

}
